package User;
import manager.ManagerLogin;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.*;

public class Login extends JFrame{
    JPanel root;
    JLabel libraryname;
    JButton userlogin,managerlogin;

    public Login() throws SQLException, ClassNotFoundException {
        root = new JPanel();
        setContentPane(root);
        setLayout(null);

        libraryname = new JLabel("欢迎来到R6图书馆");
        libraryname.setBounds(100, 20, 200, 100);
        root.add(libraryname);


        userlogin = new JButton("用户登录");
        userlogin.setBounds(50, 116, 120, 23);
        root.add(userlogin);

        managerlogin = new JButton("管理员登录");
        managerlogin.setBounds(174, 116, 120, 23);
        root.add(managerlogin);

        setDefaultCloseOperation(EXIT_ON_CLOSE);
        setBounds(400, 300, 340, 256);
        setVisible(true);

        userlogin.addActionListener(e-> {
            Userlogin userlogin1 = new Userlogin();
            userlogin1.setVisible(true);
            dispose();
        });
        managerlogin.addActionListener(e-> {
            ManagerLogin managerlogin1 = new ManagerLogin();
            setVisible(false);
        });
    }
    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        new Login();
    }
}